/**
 * Created with IntelliJ IDEA.
 * User: liulinhui
 * Date: 18-10-9
 * Time: 上午11:50
 * Description: crypto.js
 */
import cryptoModule from './crypto/index'

global.Buffer = global.Buffer || require('buffer').Buffer;
let naclFactory = global.naclFactory = require('js-nacl');

naclFactory.instantiate(function (nacl) {
  global.naclInstance = nacl;
});

export default {
  bufferToHex: cryptoModule.bufferToHex,
  hexToBuffer: cryptoModule.hexToBuffer,
  useFirstEightBufferEntriesReversed: cryptoModule.useFirstEightBufferEntriesReversed,
  verifyMessageWithPublicKey: cryptoModule.verifyMessageWithPublicKey,
  signMessageWithSecret: cryptoModule.signMessageWithSecret,
  signAndPrintMessage: cryptoModule.signAndPrintMessage,
  printSignedMessage: cryptoModule.printSignedMessage,
  getPrivateAndPublicKeyFromSecret: cryptoModule.getPrivateAndPublicKeyFromSecret,
  getRawPrivateAndPublicKeyFromSecret: cryptoModule.getRawPrivateAndPublicKeyFromSecret,
  getAddressFromPublicKey: cryptoModule.getAddressFromPublicKey,
  getSha256Hash: cryptoModule.getSha256Hash,
  encryptMessageWithSecret: cryptoModule.encryptMessageWithSecret,
  decryptMessageWithSecret: cryptoModule.decryptMessageWithSecret,
  convertPublicKeyEd2Curve: cryptoModule.convertPublicKeyEd2Curve,
  convertPrivateKeyEd2Curve: cryptoModule.convertPrivateKeyEd2Curve
}
